package com.health.service;

import com.health.dao.HealthDao;
import com.health.pojo.ExamineOrder;
import com.health.pojo.HealthAttributes;
import com.health.utils.PageInfo;

public class HealthService {

    HealthDao healthDao = new HealthDao();

    public PageInfo<HealthAttributes> selectHealthData(Integer userId, String serviceType, int currentPage, String searchValue, String searchExamineDate) {
        PageInfo<HealthAttributes> pageInfo = null;
        //  判断业务类型
        if ("page".equals(serviceType)) {
            // 放入当前页和每页记录数
            pageInfo = new PageInfo<HealthAttributes>(currentPage, 5);
            // 执行id查询方法（需要查询用户健康属性独立关系表，健康属性表）根据页码
            healthDao.selectHealthAttributeById(pageInfo, userId, true, searchExamineDate);
        } else if ("search".equals(serviceType)) {
            pageInfo = new PageInfo<HealthAttributes>(currentPage, 5);
            pageInfo.setSearchValue(searchValue);
            healthDao.selectHealthAttributeById(pageInfo, userId, false, searchExamineDate);
        }
        return pageInfo;
    }


}
